<?php
class Control_dwz_dgheard extends QUI_Control_Abstract
{
	protected $method = 'GET';
	protected $action = '';
	/**
	 * 
	 * Enter description here ...
	 * @var QForm
	 */
	protected $AjaxForm = NULL;
	/**
	 * 
	 * Enter description here ...
	 * @var QForm
	 */
	protected $pageHeader = NULL;
	
	/**
	 * 
	 * Enter description here ...
	 * @var string 高级查询接口地址
	 */
	protected $interface_query = '';
	function render()
	{
		
		$this->AjaxForm = $this->get('AjaxForm');
		$this->pageHeader = $this->get('pageHeader');
		$this->interface_query = $this->get('interface_query','#');
		$out = '<form ';
		foreach ($this->AjaxForm->attrs() as $attr => $value)
		{
			$value = h($value);
			$out .= "{$attr}=\"{$value}\"";
		}
		foreach ($this->AjaxForm->elements() as $element)
		{
			$out.= Q::control($element->_ui, $element->id, $element->attrs());
		}
		$out .= ' </form>';
		$out .= $this->_format_PageHeader();
		return $out;
	}
	/**
	 * 
	 *2011-12-21-下午11:21:23 by 460932465
	 * @return 返回当前URL
	 */
	protected function _get_CurUrl()
	{
		return $this->_context->requestUri;
	}
	
	protected function _format_PageHeader()
	{
		$out ='<div class="pageHeader">
		<form ';
		foreach ($this->pageHeader->attrs() as $attr => $value)
		{
			$value = h($value);
			$out .= "{$attr}=\"{$value}\" ";
		}
		$out.='<div class="searchBar">
		<ul class="searchContent">';
			foreach ($this->pageHeader->elements() as $element)
		{
			$out.='<li>
				<label>'.$element->_label.'</label>';
			$out.= Q::control($element->_ui, $element->id, $element->attrs());
			$out.='</li>';
		}
		$out.='</ul>';	
		
		$out.='<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
				<li><a class="button" href="'.$this->interface_query.'" target="dialog" mask="true" title="查询框"><span>高级检索</span></a></li>
			</ul>
		</div>
	</div>
	</form>
</div>';
	return $out;	
	}
}
?> 